﻿@model  CityInfoViewModel

@{
    Layout = null;

    var CityInfo = Model;
    if (CityInfo == null)
    {
        CityInfo = new CityInfoViewModel();
    }
    CityInfo.CityID = string.IsNullOrEmpty(CityInfo.CityID) ? "000000" : (CityInfo.CityID + "000000");
    CityInfo.CityID = CityInfo.CityID.Substring(0, 6);
    CityInfo.CityName = string.IsNullOrEmpty(CityInfo.CityName) ? "全国" : CityInfo.CityName;
    string display_dist = CityInfo.ShowDeep >= 3 ? "" : "none";
    string display_city = CityInfo.ShowDeep >= 2 ? "" : "none";
}

<div id="@CityInfo.DivID" class="city_select">
    <select id="selSheng" name="selSheng" class="prov" style="width:50px;"></select>

    <select id="selShi" name="selShi" class="city" style="width:80px; display:@display_city"></select>


    <select id="selQu" name="selQu" class="dist" style="width:100px; display:@display_dist"></select>

    <input type="hidden" value="@CityInfo.CityID" name="@CityInfo.CityIDFormName" class="hid_cityid" />
    <input type="hidden" value="@CityInfo.CityName" name="@CityInfo.CityNameFormName" class="hid_cityname" />
</div>

<script src="~/Css/assets/js/jquery.cityselect-local.js"></script>
<script>
    pro = "@(string.IsNullOrEmpty(CityInfo.CityID) ? "000000" : CityInfo.CityID.Substring(0, 2) + "0000")";
    city = "@(string.IsNullOrEmpty(CityInfo.CityID) ? "000000" : CityInfo.CityID.Substring(0, 4) + "00")";
    dist = "@(string.IsNullOrEmpty(CityInfo.CityID) ? "000000" : CityInfo.CityID)";

    $("#@CityInfo.DivID").citySelect({
        url: "/Css/assets/js/CityJson.txt",
        prov: pro,//省
        city: city,//市
        dist: dist//区
    });

</script>